Skip to content

fix(web): hover styles work for mice reported as non-hovering - #40845

Open
donpimponnousacondom-afk wants to merge 1 commit into
pingdotgg:mainfrom
donpimponnousacondom-afk:fix/hover-for-non-hovering-mice
Open

donpimponnousacondom-afk wants to merge 1 commit into
pingdotgg:mainfrom
donpimponnousacondom-afk:fix/hover-for-non-hovering-mice

Conversation

@donpimponnousacondom-afk

Copy link
Copy Markdown

Problem

On Linux behind VNC, the buttons under each assistant response (copy, fork, reply) never appear on hover. Their tooltips still open, so the app shows "Fork from this response" over a button it keeps invisible. I did not know those buttons existed until I asked why a tooltip was floating over nothing.

The row is opacity-0 … group-hover/assistant:opacity-100. Tailwind gates hover: on @media (hover: hover), and on this display Chromium reports hover: none, any-hover: none and pointer: none while still delivering normal pointerType: "mouse" events. So every hover: and group-hover: utility in the web client is inert there, not only this row.

To reproduce: run the desktop app, or t3 in Chromium, on an X11 session served over VNC. Open a thread with a completed assistant response and move the mouse over it.

The fork tooltip appears while the toolbar stays invisible

Change

  • main.tsx: when (any-hover: hover) is false at boot, track the last pointer type. A mouse pointermove sets data-mouse-hover on <html>; touch and pen clear it. A pointerdown can only clear it, because HostedBrowserWebview replays a synthetic mouse pointerdown.
  • index.css: the hover and any-hover variants also match :hover under that marker. :where() gives the fallback the same specificity as the media-gated rule, and Tailwind keeps the variant's place in the cascade order.
  • main.test.ts: the boot test covers mouse, touch, pen, presses, the replayed mouse press, and a machine that reports hover.

Machines that report a hovering pointer never attach the listeners. Desktop wraps the same web bundle. Mobile is React Native and does not use this CSS.

Scope

A small fix for an obvious bug: hover-revealed buttons stay invisible while their own tooltips open. No new setting and no new UI text, so it has no linked issue.

Related: #21589 reported the same Chromium misreport on a Windows 2-in-1 and was closed as upstream. This case differs in three ways. On a VNC display the misreport is permanent: restarting the app or changing posture does not clear it. The app already receives the mouse events and acts on them for tooltips, so it contradicts itself. And the fix reads only those events: a machine that reports hover correctly never runs the new code.

This is intended to replace #39090 by @MyDigitalLife, which adds the same detection for the sidebar's any-hover actions and names plain hover: as a separate change. #39090 now conflicts with main after #26451. This PR carries its detection, rebased past #26451, with two changes: the marker follows the last pointer type instead of being set once, and the any-hover fallback uses :where() instead of :is(). Its author is credited as co-author on the commit.

Not covered: a tab whose hover capability changes after boot, pointer movement inside a guest webview, the preview annotation overlay (it compiles its own stylesheet), and pointer: fine gates such as the timeline minimap, which are a separate query.

Verification

Found on Debian 13, X11 over VNC, T3 Code 0.1.11 desktop. On that display Chromium and Electron 44 both report hover: none, any-hover: none, pointer: none.

Electron, this commit. The desktop app run with vp run dev:desktop on that display, against an isolated, seeded .t3, with the mouse over the assistant response of a Replay showcase thread:

  • Before (main's index.css and main.tsx swapped in): the row matches :hover, the marker is absent, and the toolbar's computed opacity is 0.
  • After: the row matches :hover, data-mouse-hover is set, and the toolbar's computed opacity is 1.
Before After
Before: no toolbar under the hovered response After: copy, fork and reply under the hovered response

Chromium, same listener code before the rebase. In the web client on that display: mouse move, touch tap, mouse move gave marker on, off, on. A touch tap followed by a synthetic mouse pointerdown left it off.

Tests. The main.test.ts rows that expect the marker fail on main and pass with the fix. vp run check:changed passes: format, lint, knip, typecheck, tests and the React compiler.

Cost. Each hover rule is emitted twice, so the main stylesheet grows from 73.6 KB to 75.7 KB gzipped.

Not checked. A rebuilt AppImage. A physical pointer on the patched build: input in the runs above was dispatched through the DevTools protocol. I did not write a scenario for vp run scenarios:prove, because the bug needs a browser that reports no hovering pointer, which depends on the display.

Made with Claude Fable 5.2 in Claude Code, inside T3 Code. The detection carried from #39090 was made with Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

May the Code Be with You

Behind VNC/VDI, Chromium reports `hover: none` and `any-hover: none`
while delivering real mouse events. Tailwind gates `hover:` on
`(hover: hover)`, so every `hover:` and `group-hover:` utility is inert
and controls revealed on hover, such as the assistant response toolbar
(copy, fork, reply), stay invisible.

When no hovering pointer is reported at boot, track the last pointer
type: a mouse move sets `data-mouse-hover` on the root, touch and pen
clear it. Presses can only clear it, because the app replays synthetic
mouse presses. The `hover` and `any-hover` variants also match under
that marker; `:where()` keeps the fallback at the specificity of the
media-gated rule, so `active:` and state variants still win.

Builds on pingdotgg#39090, which added the detection for the sidebar's
`any-hover` actions.

Co-authored-by: peter <p.e.smeets@gmail.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The web app now tracks mouse pointer movement when (any-hover: hover) does not match. It sets or removes a document-root marker and uses that marker as a fallback in the any-hover and hover CSS variants.

Changes: Mouse hover fallback

Layer / File(s) Summary
Pointer tracking and validation
apps/web/src/main.tsx, apps/web/src/main.test.ts
When (any-hover: hover) does not match, capture-phase, passive pointer listeners update the document-root marker. Tests cover pointer-event combinations and retain the lazy-chunk reload assertions.
Hover variant fallback
apps/web/src/index.css
The any-hover and hover variants retain their media-query branches and add fallback branches for hovered descendants of [data-mouse-hover].

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant BrowserPointerEvents
  participant main.tsx
  participant document.documentElement
  participant hoverCSSVariants
  BrowserPointerEvents->>main.tsx: Dispatch pointermove or pointerdown
  main.tsx->>document.documentElement: Set or remove data-mouse-hover
  document.documentElement->>hoverCSSVariants: Match descendant hover selector
Loading

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 26592

This change makes hover-revealed controls visible for mice that Chromium reports as non-hovering, such as over VNC. The pointer listeners and CSS fallback apply only when the browser reports no hover capability. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: hover styles now work for mice that the browser reports as non-hovering. The changeset adds boot-time pointer detection in main.tsx, a data-mouse-hover marker, and a C…
Description check Passed The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each contains specific content. The Problem section gives the reproduction steps and envi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: hover styles now work for mice that the browser reports as non-hovering. The changeset adds boot-time pointer detection in main.tsx, a data-mouse-hover marker, and a CSS fallback in index.css for hover and any-hover variants, which the title covers. The title follows the conventional commit format and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each contains specific content. The Problem section gives the reproduction steps and environment. The Change section explains the fix across main.tsx, index.css, and main.test.ts. The Scope section explains why no issue is linked and mentions a related issue and PR. The Verification section gives observed before and after results, the test status, the stylesheet size cost, and what was not checked. The model and harness attribution the template asks for is present. The description is long, but it covers every required section with substance.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 31790d8 and 2659233.

Files selected for processing: 3

  • apps/web/src/index.css
  • apps/web/src/main.test.ts
  • apps/web/src/main.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant